The present invention relates generally to methods and systems for rendering computer generated images and more particularly to methods and apparatus for rendering image objects on a hard copy device.
In many computer systems, it is common to represent and convey information to a user through digital images. These images may take a variety of forms such as alphanumeric characters and graphs and other pictorial representations. The digital images are conveyed to a users on graphical rendering devices, such as video monitors, printers and the like. Typically, the digital images are stored in digital form, manipulated and then displayed on a monitor or printed on a hard copy device such as a printer.
To provide flexibility and high quality output, printers capable of accepting page description languages were developed whereby a page with graphics, text, and images may be represented using successive commands of the page description language. In these printers, after receiving the page description language commands, a desired image is rasterized so that a print engine in the printer can generate the page by turning on or off individual dots or pixels across the printed page in a raster scan line.
One popular page description language is the PostScript(copyright) page description language available from Adobe Systems Incorporated of San Jose, Calif. The PostScript(copyright) page description language is described in PostScript Language Reference Manual, Addison-Wesley (2d. ed. 1993). Moreover, over the years, a number of versions of this language have been developed. Each PostScript(copyright) version defines application programming interface (API) providing a number of predefined geometric primitives.
In computer graphics, color may be applied to a region by defining a single color for the entire region (a xe2x80x9cflatxe2x80x9d coloring), or to add realism, multiple colors may be employed. In order to display a realistic image, a smooth transition between colors across painted areas is often required. This capability is required for both the display device as well as the hard copy device. One version of the PostScript(copyright) language, Level 3, supports smooth transitions between paths and between colors. Once a smooth shading is defined for a particular region, a user may easily adjust the shading and create complex color gradients for the filled region. Smooth shading has an additional benefit over conventional shading techniques: because the gradients are rendered pixel by pixel on the given display device, they can include all of the colors the device is capable of reproducing, and at the highest resolution possible.
Presently, as the smooth shading capability is available only for Level 3 PostScript(copyright) printers, it would be desirable to add this capability to earlier PostScript(copyright) printers to save users the expenses associated with buying new printers. However, subtle color changes in a shaded region may be difficult to express in terms of standard geometric primitives of earlier versions of Postscript(copyright) since each shaded region may need to be defined as its own unique polygon primitive. As the number of unique polygon primitives increase, the time required to render the primitives also increases.
Moreover, many graphics APIs support the rendering of sampled image data which may emulate the desired graphical effect. However, particular shapes of the graphics primitives may not match the shape of the image, leading to an improper rendering of the image on the hard copy device.
The invention renders a resolution independent object having a silhouette by rendering the object to a buffer, determining the silhouette of the object from the buffer, generating a clipped image of the silhouette, and rendering the clipped image on the graphical rendering system.
Implementations of the invention may include the following. The method may render the object to the alpha channel. Moreover, the silhouette may be determined by searching the alpha channel. The method may also calculate one or more edges of the object from the silhouette. The method may also extrapolate the edges of the object. The extrapolation may be done by extending bits associated with the color of the edges of the object in the buffer. The method can also compress the clipped image using a number of standard or conventional compression methods such as Joint Photographics Expert Group (JPEG) compression.
In implementations involving PostScript(copyright) printers, the clipping step is performed using a PostScript(copyright) clip operator and the rendering step is performed using a PostScript(copyright) image operator.
In another aspect, the method renders the resolution independent object on a graphical rendering system having an application program interface (API) by retrieving the resolution independent object and generating a smoothly shaded image of the resolution independent object. The smoothly shaded image is generated by: rendering the object as a raster image in a first buffer; calculating a silhouette of the raster image; calculating a clipping path from the silhouette, the clipping path defining the silhouette of the object; and providing the raster image and the clipping path to the rendering system API.
Implementations of this aspect include the following. The API is a PostScript Level 1 or Level 2 API. The clipping path may define a shape comprising a plurality of closed area regions with no holes. Further, the clipping path may define a shape comprising a region having a hole. Alternatively, the clipping path may be multi-line segment region boundaries. The calculation of the clipping path may be done by fitting curve segments to boundary points calculated for the silhouette. The invention may render the boundary of the object to a second buffer and subtract the contents of the second buffer from the first buffer. Thus, when the first and second buffers store alpha values, the alpha value of the second buffer is subtracted from the alpha value of the first buffer.
The invention has numerous advantages. The invention allows a graphical object that cannot be easily represented with existing graphics primitives of an API to be rendered using commonly available image and clipping operations. The calculation of the clipping region is robust. Thus, the invention can handle complex graphical objects such as those specified as Bezier patches which may fold over on themselves, leaving boundaries that are not defined explicitly in the specifications of the graphical objects. A high output resolution is achieved because the image on the hard copy device may not be rendered at the same resolution the graphical object was rendered at. The clipped image data is the new intermediate format of the graphic, and can thus be rendered on any device capable of rendering clipped images. The image, when rendered on the device, will then be resampled to the device resolution with minimal artifacts such as jaggy edges.